# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=dash
pkgver=0.5.12
pkgrel=2
pkgdesc="Small and fast POSIX-compliant shell"
url="http://gondor.apana.org.au/~herbert/dash/"
arch="all"
license="BSD-3-Clause AND GPL-2.0-or-later"
# needs 'nl' utility from coreutils
makedepends="coreutils"
install="$pkgname.post-install $pkgname.post-upgrade $pkgname.pre-deinstall"
subpackages="$pkgname-doc $pkgname-binsh"
source="http://gondor.apana.org.au/~herbert/dash/files/dash-$pkgver.tar.gz"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	./src/dash -c 'echo ok'
}

package() {
	make DESTDIR="$pkgdir" install
}

binsh() {
	pkgdesc="dash as /bin/sh"
	provides="/bin/sh"
	provider_priority=60  # lower (other provider is busybox-binsh, yash-binsh)

	mkdir -p "$subpkgdir"/bin
	ln -s /usr/bin/dash "$subpkgdir"/bin/sh
}

sha512sums="
13bd262be0089260cbd13530a9cf34690c0abeb2f1920eb5e61be7951b716f9f335b86279d425dbfae56cbd49231a8fdffdff70601a5177da3d543be6fc5eb17  dash-0.5.12.tar.gz
"
